﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>从表事件 </title>
    <script type="text/javascript">
      
    </script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>

    <base target="_self" />
    <script type="text/javascript">
        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }

        /*隐藏与显示.*/
        function ShowHidden(ctrlID) {

            var ctrl = document.getElementById(ctrlID);
            if (ctrl.style.display == "block") {
                ctrl.style.display = 'none';
            } else {
                ctrl.style.display = 'block';
            }
        }
    </script>

    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            //从表事件.
            var ens = new Entities("BP.Sys.FrmEvents");
            ens.Retrieve("FK_MapData", GetQueryString("FK_MapData"));

            for (var i = 0; i < ens.length; i++) {

                var en = new Entity("BP.Sys.FrmEvent", ens[i]);

                var newRow = "";
                newRow = "<tr ><td class=Idx>" + (i + 1) + "</td>";
                newRow += "<td><a href='ActionForDtlEntity.htm?&FK_Event=" + en.FK_Event + "&MyPK=" + en.MyPK + "&FK_MapData="+en.FK_MapData+"&FK_Node=" + en.FK_Node + "'>" + en.FK_Event + "</a></td>";
                newRow += "<td>" + PushWayText(en.FK_Event, en.EventDoType) + "</td>";
                newRow += "<td>" + en.DoDoc + "</td>";
                newRow += "<td><a href=\"javascript:Delete('" + en.MyPK + "')\"><img src='../../../WF/Img/Btn/Delete.gif' border=0 />删除</a>";
                newRow += "</td>";
                newRow += "</tr>";

                $("#Table1 tr:last").after(newRow);
            }
        });


        function PushWayText(EventListOfNode, doType) {

            var ret = { "DtlSaveBefore": ["不发送", "发送给当前节点的所有处理人", "从表保存之前", "其他节点的处理人"],
                "DtlSaveEnd": ["不发送", "发送给下一个节点的所有接受人", "从表保存之后", "其他节点的处理人"],
                "DtlItemSaveBefore": ["不发送", "发送给被退回的节点处理人", "从表的行保存之前", "其他节点的处理人"],
                "DtlItemSaveAfter": ["不发送", "撤销工作后通知的节点接受人", "从表的行保存之后", "其他节点的处理人"],
                "DtlItemDelBefore": ["不发送", "流程结束通知的所有流程的参与人", "从表的行删除之前", "其他节点的处理人"],
                "DtlItemDelAfter": ["不发送", "流程删除后通知所有流程的参与人", "从表的行删除之后", "其他节点的处理人"]
            };

            return ret[EventListOfNode][doType];
        }

        function Delete(myPK) {

            if (window.confirm('您确定要删除吗？') == false)
                return;
            var en = new Entity("BP.Sys.FrmEvent");
            en.MyPK = myPK;
            en.Delete();
            window.location.href = window.location.href;
        }

        function ActionForDtlEntity(eventType) {

            var url = 'ActionForDtlEntity.htm?FK_Node=' + GetQueryString('FK_Node');
            url += '&FK_Flow=' + GetQueryString('FK_Flow');
            url += '&FK_Event=' + eventType;
            url += '&FK_MapData=' + GetQueryString('FK_MapData');
            url += '&tk=' + Math.random();

            window.location.href = url;
        }

          //删除.
        function Del(mypk) {
         
            if (window.confirm('您确定要删除吗?') == false)
                return;

            var eventEn = new Entity("BP.Sys.FrmEvent",mypk);
            eventEn.SetPKVal(mypk);
            eventEn.Delete();

            window.location.href = window.location.href;
        }

    </script>
 
    
</head>
<body onkeypress="Esc();" style="font-size: smaller">
    <form method="post" action="./ActionForDtl.htm?FK_Node=102&amp;FK_Flow=001&amp;tk=0.047329046785519&amp;s=0.3961371863054315"
    id="form1">    
    <div style="margin:8px">
        <table id="Table1" style="width: 100%">
            <caption>
                <div style="float: left"><img src='../../Img/Event.png' /> 从表事件</div>
                <div style="float: right">
                    <a href="http://ccbpm.mydoc.io" target="_blank">帮助</a>
                </div>
            </caption>
            <tr>
                <th> 序 </th>
                <th> 标记 </th>
                <th>事件名称 </th>
                <!--<th> 执行类型 </th>-->
                <th> 内容 </th>
                <th>操作 </th>
            </tr>
        </table>
        <fieldset style="border: 0px;">
        <input type="button" value="+新建事件" id="Btn_Save" onclick="ShowHidden('state')" />&nbsp;&nbsp; 
            <div id="state" style="display: none; color: Gray">
                <ul>
                    <li><a href="javascript:ActionForDtlEntity('DtlSaveBefore');">从表保存前</a> </li>
                    <li><a href="javascript:ActionForDtlEntity('DtlSaveEnd');">从表保存后</a>
                    </li>
                    <li><a href="javascript:ActionForDtlEntity('DtlItemSaveBefore');">单条数据保存前</a>
                    </li>
                    <li><a href="javascript:ActionForDtlEntity('DtlItemSaveAfter');">单条数据保存后</a>
                    </li>
                    <li><a href="javascript:ActionForDtlEntity('DtlItemDelBefore');">单条删除前</a>
                    </li>
                    <li><a href="javascript:ActionForDtlEntity('DtlItemDelAfter');">单条删除后</a>
                    </li>
                </ul>
            </div>
        </fieldset>
    </div>
    </form>
</body>
</html>
